@namespace SwashbucklerDiary.Rcl.Pages
@inherits ImportantComponentBase

<MCard Class="my-list-card"
       Elevation="0"
       Rounded="@("lg")">
    <MList>
        <MListItem OnClick="()=>showBackups=true">
            <MListItemIcon>
                <MIcon Class="evident-icon">
                    mdi:mdi-folder-arrow-down-outline
                </MIcon>
            </MListItemIcon>
            <MListItemContent>
                <MListItemTitle>
                    @(I18n.T("Backup"))
                </MListItemTitle>
                <MListItemSubtitle Class="text-caption-xs-only">
                    @(I18n.T("Save the zip file generated as a database file"))
                </MListItemSubtitle>
            </MListItemContent>
            <MListItemAction>
                <MIcon>chevron_right</MIcon>
            </MListItemAction>
        </MListItem>

        <MDivider Class="mx-5"></MDivider>

        <MListItem OnClick="Restore">
            <MListItemIcon>
                <MIcon Class="evident-icon">
                    mdi:mdi-folder-arrow-up-outline
                </MIcon>
            </MListItemIcon>
            <MListItemContent>
                <MListItemTitle>
                    @(I18n.T("Restore"))
                </MListItemTitle>
                <MListItemSubtitle Class="text-caption-xs-only">
                    @(I18n.T("Select the zip file containing the database files"))
                </MListItemSubtitle>
            </MListItemContent>
            <MListItemAction>
                <MIcon>chevron_right</MIcon>
            </MListItemAction>
        </MListItem>
    </MList>
</MCard>

<CustomMDialog @bind-MyValue="showBackups"
                  ContentClass="rounded-lg"
                  MaxWidth="420">
    <MCard>
        <MCardTitle Class="font-weight-bold">
            @(I18n.T("Backup"))
            <MSpacer></MSpacer>
            <MButton Icon="true"
                     OnClick="@(()=>showBackups=false)">
                <MIcon>close</MIcon>
            </MButton>
        </MCardTitle>
        <MCardText Class="pb-0">
            @(I18n.T("The backup file contains diary data, media files, and Settings"))
        </MCardText>
        <MCardActions>
            <MSpacer></MSpacer>
            <MButton Text="true"
                     OnClick="()=>showBackups=false">
                @(I18n.T("Cancel"))
            </MButton>
            <MButton Text="true"
                     Color="primary"
                     OnClick="Backups">
                @(I18n.T("OK"))
            </MButton>
        </MCardActions>
    </MCard>
</CustomMDialog>

<CustomMDialog @bind-MyValue="showRestore"
                  ContentClass="rounded-lg"
                  MaxWidth="420">
    <MCard>
        <MCardTitle Class="font-weight-bold">
            @(I18n.T("Confirm restore"))
            <MSpacer></MSpacer>
            <MButton Icon="true"
                     OnClick="@(()=>showRestore=false)">
                <MIcon>close</MIcon>
            </MButton>
        </MCardTitle>
        <MCardText Class="pb-0">
            @(I18n.T("The database file will be overwritten. Do you want to continue?"))
        </MCardText>
        <MCardActions>
            <MSpacer></MSpacer>
            <MButton Text
                     OnClick="()=>showRestore=false">
                @(I18n.T("Cancel"))
            </MButton>
            <MButton Text
                     Color="primary"
                     OnClick="ConfirmRestore">
                @(I18n.T("OK"))
            </MButton>
        </MCardActions>
    </MCard>
</CustomMDialog>